<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>地址栏</title>
    <script>
        function f1(){
            console.log(window.location);
            console.log("当前窗口地址栏地址:"+location.href);
            // 当为地址栏重新赋值时,即修改了地址栏的地址
            // 会使得页面进行跳转
            location.href = "42-消息框.html";
        }
        function f2(){
            // 获取打开当前窗口的窗口
            console.log(window.opener);
            console.log("打开当前窗口的窗口的地址栏地址为:"+opener.location.href);
            opener.location.href = "22-表格操作.html";
        }

        function f3(){
            console.log(window.parent);
            console.log("父窗口的地址栏:"+parent.location.href);
            parent.location.href = "22-表格操作.html";
        }
    </script>
</head>
<body>
<button onclick="f1()">获取当前地址栏</button><br>
<button onclick="f2()">获取打开该窗口的窗口的地址栏</button><br>
<button onclick="f3()">获取父窗口</button>
</body>
</html>